﻿namespace my_webapi_demo.Common;

/// <summary>
/// 应用配置（使用前请先初始化）
/// </summary>
public class AppConfig
{
    private static readonly AppConfig _settings = new();
    public static AppConfig Settings => _settings;
    public static void Init()
    {
        var jsonPath = Path.GetFullPath("config\\appsettings.json", Environment.CurrentDirectory);

        var config = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
            .AddJsonFile(jsonPath)
            .Build();
        config.Bind(_settings);
    }



    /// <summary>
    /// Redis连接
    /// </summary>
    public string RedisConnection { get; set; }

    /// <summary>
    /// 实例名
    /// </summary>
    public string InstanceName { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public string SqlserverConnection { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public string MySqlConntextion { get; set; }

    /// <summary>
    /// 数据库类型
    /// </summary>
    public string DbType { get; set; }

}
